<template>
	<view class="index" :style="{height: wHeight+'px'}">
		<view class="banner">
			<image src="/static/images/index-banner.png"></image>
		</view>
		<view class="notice">
			<view class="notice-box">
				<image class="notification" src="/static/images/notification.png" mode=""></image>
				<swiper class="limitp-hg" vertical="true" autoplay="true" circular="true" interval="3000">
					<swiper-item v-for="(item, index) in msg" :key="index">
						<navigator class="scrool-list-item">{{item}}</navigator>
					</swiper-item>
				</swiper>
			</view>
		</view>
		<!-- 模块 -->
		<view class="module">
			<view class="module-item" v-for="(item, index) in modules" @click="skip(item)">
				<image :src=" '/static/images/index/' + item.img + '.png' " mode=""></image>
				<text>{{ item.text }}</text>
			</view>
		</view>
		<!-- 通知公告 -->
		<view class="announcement">
			<view class="announcement-title">
				 <view class="left-icon"> </view>
				 <text>通知公告</text>
			</view>
			<view class="announcement-content" v-html="announcementContent">
				<!-- {{ announcementContent }} -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello',
				wHeight: '', //可视区域高度
				msg : [],  //滚动公告
				modules: [
					{
						id: 1,
						img: 'so-the-search',
						text: '全网搜索',
					},{
						id: 2,
						img: 'Accurate-search',
						text: '精准搜索',
					},{
						id: 3,
						img: 'message-group',
						text: '短信群发',
					},{
						id: 4,
						img: 'london-bridge',
						text: '同城商桥',
					},{
						id: 5,
						img: 'brand-promotion',
						text: '品牌推广',
					},{
						id: 6,
						img: 'company-information',
						text: '公司资讯',
					},{
						id: 7,
						img: 'help-center',
						text: '帮助中心',
					},{
						id: 8,
						img: 'coming-soon',
						text: '敬请期待',
					},
				],
				announcementContent: '',
			}
		},
		onLoad() {
			this.wHeight = this.$store.state.ContentHeight-50;
			this.getIndex_gd();
			this.getNotice()
		},
		methods: {
			//获取滚动公告
			getIndex_gd() {
				this.$get(this.api.indexGd).then((res) => {
					this.msg = res.data;
				}).catch((err) => {
					console.log(err)
				})
			},
			//获取公告
			getNotice() {
				this.$get(this.api.notice).then((res) => {
					this.announcementContent = res.rows.content;
				}).catch((err) => {
					console.log(err)
				})
			},
			// 跳转相应模块
				
			skip(val) {
				let url;
				switch (val.id){
					case 1:
						url = '/pages/index/soTheSearch/soTheSearch';
						break;
					case 2: 
						url = '/pages/index/accurateSearch/accurateSearch';
						break;
					case 3:
						url = '/pages/index/massTexting/massTexting';
						break;
					case 4:
						url = '/pages/index/londonBridge/londonBridge';
						break;
					case 5:
						url = '/pages/index/brand';
						break;
					case 6:
						url = '/pages/my/consult';
						break;
					case 7:
						url = '/pages/index/soTheSearch/helpCenter';
				}
				
					
				uni.navigateTo({
					url: url,
				});
			}
		}
	}
</script>

<style lang="less" scoped>
	@import url('@/static/style/index/index.less');
	.scrool-list-item {
		font-size: 30rpx;
	}

</style>
